home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_01_07
/
1n07034a
< prev
next >
Wrap
Text File
|
1990-10-14
|
477b
|
31 lines
LISTING 1
/* Connect a host with the network */
#include <sys/types.h>
#include "pctcp/types.h"
#include "pctcp/pctcp.h"
#include "pctcp/sockets.h"
#include "pctcp/error.h"
int connect(long addr)
{
int nd; /* network descriptor */
struct addr a;
a.fhost = addr;
a.fsocket = SOCK_TCP_FTP;
a.lsocket = 0;
a.protocol = STREAM;
nd = net_connect(-1,STREAM, &a);
if (nd == -1) {
pneterror("net_connect");
exit(1);
}
return nd;
}